import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
const router = createBrowserRouter([
    {
        path: '/',
        element: <App />,
        children: [
            {
                path: 'home',
                lazy: async () => {
                    const { default: Home } = await import('../page/home/Index');
                    return { element: <Home /> }
                }
            },
            {
                path: 'index',
                lazy: async () => {
                    const { default: Index } = await import('../page/index/Index')
                    return {element: <Index/>}
                }
            },
            {
                path: 'my',
                lazy: async () => {
                    const { default: My } = await import('../page/my/Index');
                    return {element:<My/>}
                }
            }
        ]
    },
    {
        path: 'login',
        lazy: async () => {
            const { default: Login } = await import('../page/login/Index');
            return {element:<Login/>}
        }
    },
    {
        path: '*',
        lazy: async () => {
            const { default: Error } = await import('../page/404/Index');
            return {element:<Error/>}
        }
    }
])
export default router